#ifndef _BASE_LINE_H_
#define _BASE_LINE_H_

#define ENTRY_SIZE 4
#define ENTRY uint32_t
#define RATIO 2
#define ACC_ENTRY float
#define POS_ENTRY uint32_t

#define BLOCK_SIZE 128
#define COMPRESS_SIZE (BLOCK_SIZE/4)
#define SAMPLE_RATE 16

// indicates which buffer is clean to write
uint8_t clean_buffer = 0;

// double buffer
ENTRY write_buffer[2][BLOCK_SIZE];

// buffer to store position
POS_ENTRY pos_buffer[BLOCK_SIZE];
// buffer to store sparsified signal
ACC_ENTRY sparse_buffer[BLOCK_SIZE];
// buffer to store intermediate value in ITERATIVE algorithm
ACC_ENTRY transform_buffer[BLOCK_SIZE];
// buffer to stored the compressed signal
ACC_ENTRY output_buffer[COMPRESS_SIZE];


ENTRY raw_buffer[BLOCK_SIZE];


#ifndef ITERATIVE

#if BLOCK_SIZE==16
float HWT[ BLOCK_SIZE * BLOCK_SIZE ] = { 
0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,
0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,
0.35,0.35,0.35,0.35,-0.35,-0.35,-0.35,-0.35,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,
0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.35,0.35,0.35,0.35,-0.35,-0.35,-0.35,-0.35,
0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,
0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71
};
#endif


#if BLOCK_SIZE==32
float HWT[ BLOCK_SIZE * BLOCK_SIZE ] = { 
0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,
0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,-0.18,
0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,-0.00,-0.00,-0.00,-0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,-0.00,-0.00,-0.00,-0.00,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,
0.35,0.35,0.35,0.35,-0.35,-0.35,-0.35,-0.35,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,
0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.35,0.35,0.35,0.35,-0.35,-0.35,-0.35,-0.35,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,
0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.35,0.35,0.35,0.35,-0.35,-0.35,-0.35,-0.35,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,
0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.00,0.00,0.00,0.00,-0.00,-0.00,-0.00,-0.00,0.35,0.35,0.35,0.35,-0.35,-0.35,-0.35,-0.35,
0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,0.00,0.00,-0.00,-0.00,
0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.00,0.00,-0.00,-0.00,0.50,0.50,-0.50,-0.50,
0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71,0.00,-0.00,
0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.00,-0.00,0.71,-0.71
};
#endif


#endif

#define print_float(x) printfz1("%d.%d\n",(int)(x), ((int)((x)*10.0))%10)

#endif
